# -*- coding: utf-8 -*-
from gaesessions import SessionMiddleware

# suggestion: generate your own random key using os.urandom(64)
# WARNING: Make sure you run os.urandom(64) OFFLINE and copy/paste the output to
# this file.  If you use os.urandom() to *dynamically* generate your key at
# runtime then any existing sessions will become junk every time you start,
# deploy, or update your app!
import os
COOKIE_KEY = '\xef\x1f*\xa1\x88\xab\xb3\xc0\x15\x9cZ\xa3#FL\x94\xe67zO\xb8\xf7\xee\xb2\n>\xf3\xca+/4]\x07\xfaC\xb5\xb1\xa9\xc9m\x9fbgu\x95T|\x8d\xa6\xd5\x19\xc9\x141\xb7\x16\xf9\x8dE\xe0\xf4<\xde\x1d'

def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = SessionMiddleware(app, cookie_key=COOKIE_KEY)
  app = recording.appstats_wsgi_middleware(app)
  return app
